<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<form id="contact-form" action="<?php echo url_for('@create_contact') ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <ul>
    <?php echo $form ?>
    <li><input id="contact-submit" type="submit" value="Enviar" /></li>
  </ul>
</form>
<script type="text/javascript">
$(document).ready(function(){
  $('#contact-submit').click(function(){
    $form = $('#contact-form');
    $.ajax({
      url: $form.attr('action'),
      data: $form.serialize(),
      type: 'post',
      dataType: 'html',
      success: function(data){
        $form.parent().html(data);
      }
    });
    return false;
  });
});
</script>